home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1997 February: Technology Seed / Mac Tech Seed Feb '97.toast / ODF Release 3 / ODFDev / Draw / Sources / DrawFrm.h < prev    next >
Encoding:
Text File  |  1996-12-16  |  7.0 KB  |  209 lines  |  [TEXT/MPS ]

  1. //========================================================================================
  2. //
  3. //    File:                DrawFrm.h
  4. //    Release Version:    $ ODF 3 $
  5. //
  6. //    Author:                Henri Lamiraux
  7. //
  8. //    Copyright:            (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
  9. //
  10. //========================================================================================
  11.  
  12. #ifndef DRAWFRM_H
  13. #define DRAWFRM_H
  14.  
  15. // ----- Part Layer -----
  16.  
  17. #ifndef FWFRMING_H
  18. #include "FWFrming.h"
  19. #endif
  20.  
  21. #ifndef FWDRGDRP_H
  22. #include "FWDrgDrp.h"
  23. #endif
  24.  
  25. //========================================================================================
  26. // Forward Declaration
  27. //========================================================================================
  28.  
  29. class FW_CPresentation;
  30. class FW_CGrowBox;
  31. class CDrawPart;
  32. class CDrawSelection;
  33. class CRuler;
  34.  
  35. //========================================================================================
  36. // CDrawFrame
  37. //========================================================================================
  38.  
  39. class CDrawFrame :     public FW_CEmbeddingFrame, 
  40.                     public FW_MDraggableFrame, 
  41.                     public FW_MDroppableFrame
  42. {
  43. public:
  44.     FW_DECLARE_CLASS
  45.     FW_DECLARE_AUTO(CDrawFrame)
  46.  
  47. //----------------------------------------------------------------------------------------
  48. // Initialization/destruction
  49. //
  50. public:        
  51.     CDrawFrame(Environment *ev, 
  52.                 ODFrame* odFrame, 
  53.                 FW_CPresentation* presentation, 
  54.                 CDrawPart* drawPart);
  55.     virtual ~ CDrawFrame();
  56.  
  57. //----------------------------------------------------------------------------------------
  58. // Inherited API
  59. //
  60. public:        
  61.  
  62.     // ----- Menu
  63.     virtual FW_Handled                DoAdjustMenus(Environment *ev, FW_CMenuBar* menuBar, FW_Boolean hasMenuFocus, FW_Boolean isRoot);
  64.     virtual FW_Handled                DoMenu(Environment* ev, const FW_CMenuEvent& theMenuEvent);
  65.     
  66.     // ----- Drag and Drop
  67.     virtual ODDragResult            CanAcceptDrop(Environment *ev, ODDragItemIterator* dragInfo);
  68.  
  69.     // ----- Activate Events -----
  70.     virtual void                    DoActivateEvent(Environment* ev, const FW_CActivateEvent& theActivateEvent);
  71.  
  72.     // ----- Embedded Mouse Events -----
  73.     virtual FW_Handled                DoMouseDownInEmbeddedFrameBorder(Environment *ev, 
  74.                                                 const FW_CBorderMouseEvent& theBorderMouseEvent);
  75.     virtual FW_Handled                DoMouseDownInEmbeddedFrame(Environment* ev, 
  76.                                                 const FW_CEmbeddedMouseEvent& theEmbeddedMouseEvent);
  77.  
  78.     // ----- Adjust Cursor -----
  79.     virtual FW_Handled                AdjustCursor(Environment *ev, 
  80.                                                 ODFacet* odFacet, 
  81.                                                 const FW_CPoint& theMousePoint, 
  82.                                                 ODEventInfo* eventInfo);
  83.  
  84.     // ----- Embedding -----    
  85.     virtual FW_MProxy*                EmbeddedFrameRequested(Environment *ev,
  86.                                             FW_MProxy* baseProxy,
  87.                                             ODFrame* baseFrame,
  88.                                             ODShape* frameShape,
  89.                                             ODPart* embedPart,
  90.                                             ODTypeToken viewType,
  91.                                             ODTypeToken presentation,
  92.                                             ODID frameGroupID,
  93.                                             FW_Boolean isOverlaid,
  94.                                             FW_Boolean isSubFrame);
  95.                                             
  96.     // ----- Frame activation -----                                    
  97.     virtual void                    FocusStateChanged(Environment *ev, 
  98.                                             ODTypeToken focus, 
  99.                                             FW_Boolean newState, 
  100.                                             ODFrame* newOwner);
  101.  
  102.     // ----- Window Size ------
  103.     virtual void                    AdjustZoomedWindowSize(Environment* ev, FW_CPoint& proposedSize);
  104.     virtual void                    AdjustWindowGrowLimits(Environment* ev, FW_CPoint& minSize, FW_CPoint& maxSize);
  105.     
  106.     // ----- Commands Factory -----
  107.     virtual FW_CClipboardCommand*     NewClipboardCommand(Environment* ev, ODCommandID commandID);
  108.     virtual FW_CInsertCommand*         NewInsertCommand(Environment* ev, const FW_PFileSpecification& fileSpec);
  109.     virtual FW_CDragCommand*         NewDragCommand(Environment *ev, 
  110.                                                 FW_CFrame* theFrame,
  111.                                                 const FW_CMouseEvent& theMouseEvent);
  112.     virtual FW_CDropCommand*        NewDropCommand(Environment *ev, FW_CFrame* frame,
  113.                                                 ODDragItemIterator* dropInfo, 
  114.                                                 ODFacet* facet, const FW_CPoint& windowPoint);
  115.                                                 
  116.     // ----- Printing ------
  117.     virtual FW_CPrintHandler*        NewPrintHandler(Environment* ev);
  118.     virtual void                    GetPrintResolution(Environment* ev, unsigned long& outPreferredDPI);
  119.     
  120.     // ----- Drawing ------
  121.     virtual void                     Draw(Environment *ev, ODFacet* odFacet, ODShape* invalidShape);
  122.  
  123.     // ----- Facet -----
  124.     virtual void                    FacetAdded(Environment* ev, ODFacet* facet, unsigned short facetCount);
  125.  
  126.     // ----- Internalize/Externalize -----
  127.     virtual void                    ExternalizeFrame(Environment* ev, ODStorageUnitView* storageUnitView);
  128.     virtual void                    InternalizeFrame(Environment* ev, ODStorageUnitView* storageUnitView);
  129.     
  130.     // ----- Creation of Views from Streams
  131.     virtual void                    PostCreateViewFromStream(Environment* ev);
  132.  
  133.     // ----- Source Frame -----
  134.     virtual void                    AttachSourceFrame(Environment* ev, FW_CFrame* sourceFrame);
  135.  
  136. //----------------------------------------------------------------------------------------
  137. //    New API
  138. //
  139. public:
  140.     CDrawSelection*            GetSelection(Environment *ev) const;
  141.     FW_Fixed                GetZoomFactor() const;
  142.     void                    ToggleRulers(Environment *ev, FW_Boolean visible, FW_ERedrawVerb redraw);
  143.  
  144.     FW_Boolean                IsGraphicsGridOn() const;
  145.     FW_Boolean                AreRulersOn() const;
  146.     
  147.     FW_Boolean                IsInLinkDestination(Environment* ev);
  148.  
  149.     void                    ChangeZoomFactor(Environment* ev, FW_Fixed zoomFactor);
  150.  
  151.     void                    ChangeDocPages(Environment* ev, short pages);
  152.     
  153.     FW_CRect                GetContentRect(Environment* ev) const;
  154.     void                    AdjustContentViewSize(Environment* ev, FW_ERedrawVerb redraw);
  155.  
  156.     void                    InvalidateShadowRect(Environment *ev);
  157.  
  158.     FW_Boolean                IsPrintingFrame() const {return fIsPrintingFrame;}
  159.     
  160. //----------------------------------------------------------------------------------------
  161. // Data Members
  162. //
  163. private:    
  164.     CDrawPart*                fDrawPart;
  165.     CDrawSelection*            fSelection;
  166.     
  167.     CRuler*                    fHorzRuler;
  168.     CRuler*                    fVertRuler;
  169.     
  170.     FW_Boolean                fGridShown;
  171.     FW_Boolean                fRulersShown;
  172.     FW_Fixed                fZoomFactor;
  173.     Boolean                    fIsPrintingFrame;
  174. };
  175.  
  176. //----------------------------------------------------------------------------------------
  177. //    CDrawFrame::GetZoomFactor
  178. //----------------------------------------------------------------------------------------
  179. inline FW_Fixed    CDrawFrame::GetZoomFactor() const 
  180. {
  181.     return fIsPrintingFrame ? FW_kFixedPos1 : fZoomFactor;
  182. }
  183.  
  184. //----------------------------------------------------------------------------------------
  185. //    CDrawFrame::GetSelection
  186. //----------------------------------------------------------------------------------------
  187. inline CDrawSelection*    CDrawFrame::GetSelection(Environment*) const
  188. {
  189.     return fSelection;
  190. }
  191.  
  192. //----------------------------------------------------------------------------------------
  193. //    CDrawFrame::IsGraphicsGridOn
  194. //----------------------------------------------------------------------------------------
  195. inline FW_Boolean CDrawFrame::IsGraphicsGridOn() const
  196. {
  197.     return fGridShown && !fIsPrintingFrame;
  198. }
  199.  
  200. //----------------------------------------------------------------------------------------
  201. //    CDrawFrame::AreRulersOn
  202. //----------------------------------------------------------------------------------------
  203. inline FW_Boolean CDrawFrame::AreRulersOn() const
  204. {
  205.     return fRulersShown && !fIsPrintingFrame;
  206. }
  207.  
  208. #endif
  209.